Skip to main content

2D Array ✔

  1. Maximum one's
    1. 03 April, 2026: 00.09.36 ✔
      • Apply binary search on inner loop
      • Initial max row is 0 and value is 0
  2. Search in 2D matrix
    1. 03 April, 2026: 00.05.37 ✔
      • Divide by appropriate size
  3. Row Column Wise Sorted Matrix
    1. 03 April, 2026: 00.24.26 ❌
      • Failed at edge cases
        • Compare the row/column iterator with appropriate size(require both m and n)
        • Think which corner should be the starting point
          • One iterator should move to smaller value
          • Another iterator should move to larger value
  4. Peak Element II
    1. 04 April, 2026: 00.34.52 ❌
      • Failed at implementation
        • Fist index of array is used to iterate top-down, second index is used to iterate left-right.
        • Find the max item(row) in mids column
        • Compare it with its neighbors(left, right)
          • Don't need top, bottom as it is already compared duting max extraction
          • If condition pass, return the answer, if not then narrow down the search space
  5. Matrix Median
    1. 04 April, 2026: 00.24.57 ❌
      • Failed at implementation
        • max_element(mat.begin(), mat.end()) can't extract maximum from 2d array. Extract it by row wise sorted property
        • low, high is comes from the value of matrix
        • Extract the desired median position
        • Different number of item is used from each row to calculate the median
          1  3  5
          2 6 9
          3 6 9
          • Median position is 5
          1 3 5
          2
          3
          • This are the item used to count median
          • For each mid, check how many item appear before it